<template>
    <div class="addEditArticlePageCont">
      <div class='title'>当前位置：问答管理 / 编辑问答</div>
      <div class="addEditArticlePageMian">
        <Form ref="formAddEditArticle" :label-width="110">
          <FormItem label="问答分类：">
            {{QAclassification}}
            <span v-if="buildingAlias"> - </span>
            {{buildingAlias}}
          </FormItem>
          <FormItem label="问题描述：" prop="articleTitle">
            {{problemDescription}}
          </FormItem>
          <FormItem label="答案：" prop="articleTags">
            {{answer}}
          </FormItem>
          <div class="footer">
              <Button @click="addEditArticleReset">关闭</Button>
          </div>
      </Form>
      </div>
    </div>
</template>
<script>
  import { faqsGetDetails } from "@/api/materialManagement.js";
  export default {
    components: {

    },
    data() {
      return {
        questionTypeList: ['-', '产品使用', '政策行情', '法务知识', '楼盘问答', '其它'],
        QAclassification: '',
        problemDescription: '',
        answer: '',
        buildingAlias: ''
      }
    },
    methods: {
      addEditArticleReset() {
        this.$router.go(-1);
      },
      // 初始化获取数据
      initData() {
        faqsGetDetails({questionAnswerId: this.$route.query.questionAnswerId}).then(res=>{
          if(res) {
            this.QAclassification = this.questionTypeList[res.questionType]
            this.problemDescription = res.questionDesc
            this.answer = res.answerDesc
            this.buildingAlias = res.buildingName
          }
        }).catch(err=>{
          this.$Message.error(err)
        })
      }
    },
    computed: {

    },
    created() {
      // 初始化获取数据
      this.initData()
    },
    mounted() {

    },
    watch: {
      // "$route"(to, from) {
      //   if(to.path == "######") {
      //     this.initData();
      //   }
      // }
    },
  }
</script>
<style lang="scss" scoped>
  .addEditArticlePageCont{
    .title{
        background-color: #f5f5f5;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
        padding: 0 14px 10px;
    }
    .addEditArticlePageMian{
      margin-top: 16px;
      width: 800px;
    }
  }
  .footer{
    text-align: center;
    button{
      width: 90px;
      margin: 0 10px;
    }
  }
</style>
